var express = require('express');
const app = require('../app');
var router = express.Router();

const cn = require("china-region");
/* GET home page. */
// router.get('/', function(req, res, next) {
//   res.render('index', { title: 'Express' });
// });

router.get("/",(req,res) =>{
    res.render("index",{title: "天气"})
})


router.get("/province",(req,res) =>{
    const {code} = req.query;

    res.json(cn.getProvinces(code));
})

router.get("/city",(req,res) =>{
    const {code} = req.query;

    res.json(cn.getPrefectures(code));
})


module.exports = router;